package com.touni.designpattern.factorypattern;

/**
 * @ClassName : CarFactory
 * @Description :
 * @Author : lwq
 * @Date: 2020-10-15 15:29
 */
public class CarFactory {

    public static BaseCar getInstance(String carName){
        if ("BMW".equals(carName)){
            return new BMW();
        }else if ("Tesla".equals(carName)){
            return new Tesla();
        }else {
            return null;
            //throw new RuntimeException("get instance is null");
        }

    }


}
